home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib05.dsk
/
APPLE FINANCIER - PART II.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
9KB
|
197 lines
100 REM ----------------------
101 REM FINANCIAL PROGRAM DISK
102 REM <ARIES SOFTWARE>
103 REM LARRY ABRAMS
104 REM (C) ALL RIGHTS RESERVED
105 REM
106 REM VERSION 1.1 3.29.81
107 REM MODULES 1000,2000 NEW
108 REM APPLESOFT BASIC
109 REM -----------------------
110 :
200 REM MENU
201 ONERR GOTO 500
202 HOME : VTAB 2: HTAB 12: INVERSE : PRINT " SELECT ONE OF THE FOLLOWING ": NORMAL : GOSUB 400
210 PRINT TAB( 9)"STRAIGHT LINE DEPRECIATION <1>"
220 PRINT TAB( 3)"VAR RATE - DECL BAL DEPRECIATION <2>"
280 PRINT TAB( 14)"DIRECT REDUCTION LOAN <8>"
290 PRINT TAB( 14);"AMORTIZATION SCHEDULE <9>"
292 GOSUB 400: PRINT TAB( 24);"<RETURN> TO QUIT"
293 PRINT : PRINT : PRINT TAB( 30);"WHICH ";: POKE -16368,0: GET ANS$: PRINT ANS$
295 ANS = VAL(ANS$): IF ANS = 0 THEN END
296 ON ANS GOTO 1000,2000,3000,4000,5000,6000,7000,8000,9000
298 :
300 REM PRINT USING
302 P$ = STR$( INT((P +.005) *100))
304 IF LEN(P$) <3 THEN P$ = LEFT$("000",(3 - LEN(P$))) +P$
305 PP$ = LEFT$(P$,( LEN(P$) -2))
306 IF DP = 0 THEN P$ = PP$: GOTO 308
307 P$ = PP$ +"." + RIGHT$(P$,DP)
308 P$ = RIGHT$(" " +P$,PL)
310 RETURN
312 :
400 FOR DOT = 0 TO 39: PRINT ".";: NEXT DOT: RETURN
402 :
500 REM ERROR HANDLING ROUTINE
502 HOME : VTAB 5: INVERSE : PRINT "CHECK APPLESOFT MANUAL PG 136 FOR ERR": NORMAL
504 PRINT : PRINT "ERROR IS NUMBER "; PEEK(222): PRINT "LOCATED IN LINE "; PEEK(218) + PEEK(219) *256: POKE 34,0: END
505 :
1000 REM STRAIGHT LINE DEPRECIATION
1002 :
1004 REM PROGRAM INSTRUCTIONS
1006 CLEAR :DP = 0: HOME : VTAB 10
1008 PRINT "INSTRUCTIONS? ";: POKE -16368,0: GET ANS$: IF LEFT$(ANS$,1) < >"Y" THEN HOME : VTAB 10: GOTO 1102
1010 HOME : VTAB 5: PRINT " STRAIGHT LINE DEPRECIATION SCHEDULE": GOSUB 400
1012 PRINT "THE ANNUAL DEPRECIATION ALLOWANCE USING"
1014 PRINT "THIS METHOD IS DETERMINED BY DIVIDING"
1016 PRINT "THE COST (STARTING BOOK VALUE) LESS ITS"
1018 PRINT "ESTIMATED SALVAGE VALUE BY ITS USEFUL"
1020 PRINT "LIFE EXPECTANCY. THAT IS:": PRINT
1022 INVERSE : PRINT " DEPRECIATION ";: NORMAL : PRINT "=": PRINT
1024 PRINT "(START BK VAL - SALVAGE VAL) / (LIFE)": PRINT
1026 :
1100 REM INPUT STARTING,SALVAGE,LIFE
1102 PRINT "1. STARTING BOOK VALUE ";: IF FLAG THEN PRINT A(1): GOTO 1106
1104 INPUT A(1)
1106 PRINT "2. SALVAGE VALUE"; TAB( 24);: IF FLAG THEN PRINT A(2): GOTO 1110
1108 INPUT A(2)
1110 PRINT "3. LIFE EXPECTANCY"; TAB( 24);: IF FLAG THEN PRINT A(3): GOTO 1114
1112 INPUT A(3):FLAG = 1
1114 PRINT : PRINT "ANY CHANGES? ";: POKE -16368,0: GET ANS$: PRINT ANS$: IF LEFT$(ANS$,1) = "N" THEN 1118
1116 PRINT : INPUT "WHICH ONE? ";W: PRINT "CHANGE PART ";W;" TO: ";: INPUT A(W): HOME : VTAB 10: GOTO 1102
1118 BKVLUE = A(1):SALVAGE = A(2):LFE = A(3)
1120 PRINT : PRINT "DISPLAY ENTIRE SCHEDULE? ";: POKE -16368,0: GET ANS$: PRINT ANS$
1122 IF LEFT$(ANS$,1) = "Y" THEN I = 0: GOTO 1202
1124 PRINT "WHICH YEARS (START,END)";: INPUT I,J
1126 :
1200 REM OUTPUT HEADINGS
1202 HOME : PRINT TAB( 5);"DEPR"; TAB( 14);"REMAIN"; TAB( 25);"REMAIN"; TAB( 35);"TOTAL"
1204 PRINT "YR"; TAB( 4);"AMOUNT"; TAB( 12);"DEPR VALUE"; TAB( 23);"BOOK VALUE"; TAB( 35);"DEPREC";
1206 GOSUB 400: POKE 34,3
1208 :
1300 REM CALCULATIONS/OUTPUT
1302 IF NOT I THEN I = 1:J = LFE
1304 IF J >LFE THEN J = LFE
1306 FOR K = I TO J
1308 DEP = (BKVLUE -SALVAGE)/LFE:TDEP = K *DEP:RDV = (LFE -K) *DEP:RBV = RDV +SALVAGE
1310 PRINT SPC( 1 -(K >9));K; TAB( 4);:PL = 7:P = DEP: GOSUB 300: PRINT P$;:PL = 10:P = RDV: GOSUB 300: PRINT P$;:P = RBV: GOSUB 300: PRINT P$;:P = TDEP: GOSUB 300: PRINT P$;: REM
1312 NEXT K
1314 :
1400 REM PROGRAM ENDING
1402 PRINT : VTAB 24: POKE 34,0
1404 PRINT "ANOTHER RUN? ";: POKE -16368,0: GET ANS$: PRINT ANS$: IF LEFT$(ANS$,1) = "Y" THEN HOME : VTAB 12: GOTO 1102
1406 GOTO 200: REM RETURN TO MENU
1408 :
2000 REM VARIABLE RATE - DECLINING BALANCE DEPRECIATION
2002 :
2004 REM PROGRAM INSTRUCTIONS
2006 CLEAR :DP = 0: HOME : VTAB 10
2008 PRINT "INSTRUCTIONS? ";: POKE -16368,0: GET ANS$: IF LEFT$(ANS$,1) < >"Y" THEN HOME : VTAB 10: GOTO 2102
2010 HOME : VTAB 2: PRINT TAB( 4)"VARIABLE RATE - DECLINING BALANCE": PRINT TAB( 10)"DEPRECIATION SCHEDULE": GOSUB 400
2012 PRINT "THIS METHOD PROVIDES FOR MORE DEPRECIA-": PRINT "TION IN EARLIER YEARS AND DECREASING": PRINT "DEPRECIATION IN LATER YEARS."
2014 PRINT "THE VARIABLE RATE IS A FACTOR (E.G. 1.5": PRINT "OR 1.25) THAT'S THE SAME AS A DECLINING BALANCE PERCENTAGE."
2016 PRINT
2018 PRINT "THIS SCHEDULE WILL ALSO GIVE THE CROSS-": PRINT "OVER POINT (HI-LIGHTED), WHERE THE": PRINT "SWITCH FROM THIS METHOD TO THE STRAIGHT"
2020 PRINT "LINE METHOD SHOULD BE MADE. AT THIS": PRINT "POINT, STRAIGHT LINE DEPRECIATION IS"
2022 PRINT "GREATER THAN THAT BY THE DECLINING": PRINT "BALANCE METHOD."
2024 PRINT
2026 :
2100 REM INPUT STARTING,SALVAGE,LIFE,FACT
2102 PRINT "1. STARTING BOOK VALUE ";: IF FLAG THEN PRINT A(1): GOTO 2106
2104 INPUT A(1)
2106 PRINT "2. SALVAGE VALUE"; TAB( 24);: IF FLAG THEN PRINT A(2): GOTO 2110
2108 INPUT A(2)
2110 PRINT "3. LIFE EXPECTANCY"; TAB( 24);: IF FLAG THEN PRINT A(3): GOTO 2114
2112 INPUT A(3)
2114 PRINT "4. RATE FACTOR"; TAB( 24);: IF FLAG THEN PRINT A(4): GOTO 2118
2116 INPUT A(4):FLAG = 1
2118 PRINT : PRINT "ANY CHANGES? ";: POKE -16368,0: GET ANS$: PRINT ANS$: IF LEFT$(ANS$,1) = "N" THEN 2122
2120 PRINT : INPUT "WHICH ONE? ";W: PRINT "CHANGE PART ";W;" TO: ";: INPUT A(W): HOME : VTAB 10: GOTO 2102
2122 BKVLUE = A(1):SALVAGE = A(2):LFE = A(3):FACT = A(4)
2124 PRINT : PRINT "DISPLAY ENTIRE SCHEDULE?";: POKE -16368,0: GET ANS$: PRINT ANS$
2126 IF LEFT$(ANS$,1) = "Y" THEN I = 0: GOTO 2202
2128 PRINT "WHICH YEARS (START,END)";: INPUT I,J
2130 :
2200 REM OUTPUT HEADING
2202 HOME : PRINT TAB( 5);"DEPR"; TAB( 14);"REMAIN"; TAB( 25);"REMAIN"; TAB( 35);"TOTAL"
2204 PRINT "YR"; TAB( 4);"AMOUNT"; TAB( 12);"DEPR VALUE"; TAB( 23);"BOOK VALUE"; TAB( 35);"DEPREC"
2206 GOSUB 400: POKE 34,3
2208 :
2300 REM CALCULATION/OUTPUT
2302 IF NOT I THEN I = 1:J = LFE
2304 IF J >LFE THEN J = LFE
2306 FOR K = 1 TO J
2308 DEP = (1 -FACT/LFE) ^(K -1) *(FACT/LFE) *BKVLUE:TDEP = (1 -((1 -FACT/LFE) ^(K))) *BKVLUE
2310 RDV = BKVLUE -SALVAGE -TDEP:RBV = RDV +SALVAGE
2312 IF (LFE -K) *DEP <RDV THEN INVERSE
2314 PRINT SPC( 1 -(K >9));K; TAB( 4);:PL = 7:P = DEP: GOSUB 300: PRINT P$;:PL = 10:P = RDV: GOSUB 300: PRINT P$;:P = RBV: GOSUB 300: PRINT P$;:P = TDEP: GOSUB 300: PRINT P$;: REM
2316 NEXT K: NORMAL
2318 :
2400 REM PROGRAM ENDING
2402 PRINT : VTAB 24: POKE 34,0
2404 PRINT "ANOTHER RUN? ";: POKE -16368,0: GET ANS$: PRINT ANS$: IF LEFT$(ANS$,1) = "Y" THEN HOME : VTAB 12: GOTO 2102
2406 GOTO 200: REM RETURN TO MENU
2408 :
8000 REM DIRECT REDUCTION LOAN
8002 :
8004 REM PGM INITIALIZATION
8006 CLEAR :DP = 2
8007 :
8100 REM MENU / INPUT SECTION
8102 HOME : VTAB 5
8104 PRINT "1. MAX BORROW AMOUNT"; TAB( 25);: IF FLAG THEN PRINT A(1): GOTO 8108
8106 INPUT A(1)
8108 PRINT "2. CHANGE IN AMOUNT"; TAB( 25);: IF FLAG THEN PRINT A(2): GOTO 8112
8110 INPUT A(2)
8112 PRINT "3. MAX INTEREST RATE"; TAB( 25);: IF FLAG THEN PRINT A(3): GOTO 8116
8114 INPUT A(3)
8116 PRINT "4. CHANGE IN INT RATE"; TAB( 25);: IF FLAG THEN PRINT A(4): GOTO 8120
8118 INPUT A(4)
8120 PRINT "5. LOAN TERM (MONTHS)"; TAB( 25);: IF FLAG THEN PRINT A(5): GOTO 8124
8122 INPUT A(5):FLAG = 1
8124 PRINT : INVERSE : PRINT "TYPE 'END' TO RETURN TO MENU ": NORMAL : VTAB 18: INPUT "ANY CHANGES? ";Y$
8126 IF LEFT$(Y$,1) = "N" THEN 8146
8128 IF Y$ = "END" THEN 200
8130 INPUT "WHICH ONE? ";W: PRINT "CHANGE PART ";W;" TO ";: INPUT A(W): GOTO 8102
8132 :
8134 REM PAYMENT CALCULATION
8136 I = J/1200
8138 PMT = (K *I)/(1 -(1 +I) ^( -A(5)))
8140 RETURN
8142 :
8144 REM OUTPUT HEADING SECTION
8146 HOME : HTAB 13: INVERSE : PRINT " TERM: ";A(5);" MONTHS ": NORMAL
8148 VTAB 2: PRINT "PRCNT";
8150 FOR K = A(1) -4 *A(2) TO A(1) STEP A(2):P$ = STR$( INT(K)):PL = 7: GOSUB 308: PRINT P$;: NEXT K
8152 GOSUB 400
8154 :
8156 REM MAIN PROGRAM
8158 J = A(3)
8160 P = J:PL = 5: GOSUB 302: PRINT P$;
8162 FOR K = A(1) -4 *A(2) TO A(1) STEP A(2)
8164 GOSUB 8136
8166 P = PMT:PL = 7: GOSUB 302: PRINT P$;
8168 NEXT K
8170 J = J -A(4)
8172 IF PEEK(37) <22 AND J >0 THEN 8160
8174 VTAB 24: INVERSE : PRINT " ANY KEY FOR MENU ";: NORMAL
8176 CALL -756
8178 GOTO 8102
8180 :
9000 REM AMORTIZATION SCHEDULE
9001 HOME : VTAB 5: INPUT "YEARLY INTEREST RATE % ";I:I = I/1200: INPUT "MONTHLY PAYMENT ";PMT: INPUT "INITIAL LOAN AMOUNT ";PV
9002 HOME :DP = 2
9003 PRINT TAB( 5);"PAID TO"; TAB( 15);"PAID"; TAB( 22);"REMAIN"; TAB( 33);"TOTAL"
9004 PRINT "NO"; TAB( 5);"PRINCIP"; TAB( 14);"TO INT"; TAB( 22);"BALANCE"; TAB( 32);"INTEREST": FOR DOT = 0 TO 39: PRINT ".";: NEXT DOT: POKE 34,3
9005 OB = PV:K = 1
9006 A = (1 +I) ^( -K)
9007 NB = (((A -1)/I) *PMT +PV)/A
9008 IF NB < = 0 THEN 9014
9009 PRIN = OB -NB:K$ = STR$(K):K$ = K$ +" ": PRINT LEFT$(K$,3);:P = PRIN:PL = 7: GOSUB 300: PRINT P$;
9010 IN = PMT -PRIN:P = IN:PL = 9: GOSUB 300: PRINT P$;:P = NB:PL = 10: GOSUB 300: PRINT P$;
9011 TIN = K *PMT -PV +NB:P = TIN: GOSUB 300: PRINT P$
9012 K = K +1:OB = NB
9013 IF PEEK(37) < >23 THEN 9006
9014 VTAB 24: INVERSE : PRINT " ESC TO EXIT OR ANY KEY TO CONTINUE ";: NORMAL
9015 POKE -16368,0: GET Z$: IF Z$ < > CHR$(27) THEN HOME : GOTO 9006
9016 POKE 34,0: GOTO 200